import { computed } from 'vue'
import useFetch from '@hooks/useFetch'
import { getJsComponentValidate } from '@src/api/PassApi'
import Result from '@model/Result'

const useFetchJsCodeBlockShow = async () => {
    const [result, callbackFunction] = useFetch<{}, { showFlag: boolean }>(getJsComponentValidate, {})
    await callbackFunction()
    const data = result.value as unknown as Result<{ showFlag: boolean }>
    return computed(()=> !!(data.result?.showFlag || false))
}

export default useFetchJsCodeBlockShow
